import { request } from '@/api/core/http'
import { IPhoneLoginRes,IPhoneLoginReq } from './types'

/**
 * 手机号，密码登录
 * @param content
 */
export const login = (params: IPhoneLoginReq) => {
  return request.post<IPhoneLoginRes>('/platform/api/user/login', params)
}

/**
 * 手机号，密码注册
 * @param IPhoneLoginReq
 */
export const register = (params: IPhoneLoginReq) => {
  return request.post<IPhoneLoginRes>('/platform/api/user/register', params)
}


/**
 * 手机号验证码
 * @param IPhoneLoginReq
 */
export const sendCode = (params: IPhoneLoginReq) => {
  return request.post<IPhoneLoginRes>('/platform/api/basic/send_code', params)
}

/**
 * 三方登陆接口
 * @param percent
 */

interface IParmasTokenLogin {
  key?:string
  token?:string
  idtoken?:string
}

export const tokenLogin = (params: IParmasTokenLogin) => {
  return request.post(`/platform/api/user/o2/common/token_login`,params)
}


export const openIdLogin = (params: IParmasTokenLogin) => {
  return request.post(`/platform/api/user/o2/common/openid_login`,params)
}


/**
 * 获取区号列表
 * @param
 */
export const getAreaCode = () => {
  return request.get(`https://storage.syachat.com/backend/sms_dial_code_2024-04-15.json`)
}
